package chpt02;

import java.util.Scanner;

public class SwitchDemo {

	public static void main(String[] args) {
		int x = 9;
		int y = 3;
		Scanner input = new Scanner(System.in);
		System.out.print("1-'+'、2-'-'、3-'*'、4-'/',请输入操作运算符：");
		int operator = input.nextInt();
		switch(operator) {
		case 1: 
			System.out.println("x+y=" + (x + y));
			break;
		case 2:
			System.out.println("x-y=" + (x - y));
			break;
		case 3:
			System.out.println("x*y=" + (x * y));
			break;
		case 4:
			System.out.println("x/y=" + (x / y));
			break;
		default:
			System.out.println("错误的操作运算符！" );
			break;
		}
		input.close();
	}
}
